<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.cr.model.Customer"%>
<%@ page import="com.cr.model.DiyOrder"%>
<%@ page import="com.cr.model.Cloth"%>
<%@ page import="com.cr.model.OrderDetail"%>
<%@ page import="com.cr.service.ClothService"%>
<%@ page import="com.cr.service.DiyOrderService"%>
<%@ page import="com.cr.service.OrderDetailService"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Diy order</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="style/style.css">
	<script type="text/javascript" src="easyui/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="script/main.js"></script>
  </head>
  
  <body>
   	<jsp:include page="header.jsp"></jsp:include>
    <div id="content">
    		<%
    			Customer customer=null;
    		 	if(session.getAttribute("customer")!=null)
    		 	{
    		 		customer=(Customer)session.getAttribute("customer");
    		 	}
    		 	if(customer==null)
    		 	{
    		 		out.print("<script>location.href='login.jsp';</script>");
    		 	}
    		 	
    		 	String id=request.getParameter("id");
    		 	
    		 	DiyOrderService orderService=new DiyOrderService();
    		 	DiyOrder order=null;
    		 	
    		 	if(id!=null)
    		 	{
    		 		order = orderService.getDiyOrder(Long.parseLong(id));
    		 	}
    		 %>
    	<div id="order" style="text-align:left;padding-left:100px;float:left;width:80%;">
    		<div class="need">Please input below information(the field mark '*' need necessary)</div>
    		<div class="title">client information</div>
    		<table border="1">
    			<tr>
    				<td>Client Name：</td>
    				<td><input type="text" id="clientname" value="<%=order==null?"":order.getRecvName() %>" /><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>Province：</td>
    				<td><input type="text" id="province" value="<%=order==null?"":order.getRecvProvince() %>" /><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>Address：</td>
    				<td><input type="text" id="address" value="<%=order==null?"":order.getRecvAddr() %>" /><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>Mobile Phone：</td>
    				<td><input type="text" id="phone" value="<%=order==null?"":order.getRecvPhone() %>" /><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>E-mail：</td>
    				<td><input type="text" id="email" value="<%=order==null?"":order.getRecvEmail() %>" /><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>Postal Code：</td>
    				<td><input type="text" id="postcode" value="<%=order==null?"":order.getPostCode()==null?"":order.getPostCode() %>" /></td>
    			</tr>
    		</table>
    		<div class="title">payment way and send way</div>
    		<table border="1">
    			<tr>
    				<td>Payment Way：</td>
    				<td>
    					<input type="radio" id="payway1" name="payway" value="Cash on delivery" <%=order==null?"":(order.getPayMethod().equals("Cash on delivery")?"checked":"") %> />Cash on delivery
    					<input type="radio" id="payway2" name="payway" value="Bank transfer" <%=order==null?"":(order.getPayMethod().equals("Bank transfer")?"checked":"") %>/>Bank transfer
    					<span class="need">*</span>
    				</td>
    			</tr>
    			<tr>
    				<td>Send Way：</td>
    				<td>
    					<input type="radio" id="sendway1" name="sendway" value="ZJS Express" <%=order==null?"":(order.getPostMethod().equals("ZJS Express")?"checked":"") %>  />ZJS Express
    					<input type="radio" id="sendway2" name="sendway" value="Company Express" <%=order==null?"":(order.getPostMethod().equals("Company Express")?"checked":"") %> />Company Express
    					<span class="need">*</span>
					</td>
    			</tr>
    			<tr>
    				<td>Cost：</td>
    				<td>Free</td>
    			</tr>
    		</table>
    		<div class="title">rent message</div>
    		<table border="1">
    			<tr>
    				<td>Rent days：</td>
    				<td><input type="text" id="day"  value="<%=order==null?"":order.getRentDays() %>"/><span class="need">*</span></td>
    			</tr>
    			<tr>
    				<td>Description:</td>
    				<td><textarea id="description" rows=10 cols=50><%=order==null?"":order.getDescription() %></textarea></td>
    			</tr>
    		</table>
    		<div>
    			<%
    				if(order!=null)
    				{
    			 %>
    			 	<span class="order" onclick="modifyDiyOrder();">Modify</span>
    			 <%
    			 	}
    			 	else
    			 	{
    			  %>
    			  <input type="checkbox" id="agree" /> Agree the contract<a href="javascript:seeContract();">see detail</a>
    		<div id="contract" class="easyui-window" title="Contract detail" style="width:600px;height:500px;text-align:left;padding-left:5px;"  
        				data-options="minimizable:false,maximizable:false,collapsible:false,modal:true,closed:true">
    			<p>The lessor: Beijing Zhong Ge Clothing </p>
				<p>Tenant: Customer </p>
				<p>Base on <<LAW OF THE PEOPLE'S REPUBLIC OF CHINA ON EMPLOYMENT CONTRACTS >> In order to define the relationship between right and duty, The two Parties have agreed to enter into this agreement after negotiation. Sign this contract.</p>
				<p>term of lease: total: ( ) months </p>
				<p>lessor give the costume to tenant from     to     </p>
				<p>If both sides have situations as follows: The lessor could terminate the contract and take back the costumes</p>
				<p>1.	Tenant rent or sell the costume to others without lessor’s permission</p>
				<p>2.	Tenant engaged in illegal activities and do harm to public interest.</p>
				<p>3.	Tenant do not pay rental for about 2 months </p>
				<p>If tenant refuse to pay the rental after the deadline, the lessor has rights to resort to proceeding and The tenant should be responsible for the loss of lessors.</p>"
    		</div>
    			  	<div><span class="order" onclick="addDiyOrder();">Add</span></div>
    			  <%
    			  	}
    			   %>
    			
    		</div>
    	</div>
    </div>
    <jsp:include page="footer.jsp"></jsp:include>
  </body>
</html>
